-
Notifications
You must be signed in to change notification settings - Fork 47
Improve interaction with probeinterface-library #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #364 +/- ##
==========================================
- Coverage 89.92% 89.80% -0.12%
==========================================
Files 12 12
Lines 2044 2099 +55
==========================================
+ Hits 1838 1885 +47
- Misses 206 214 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@samuelgarcia done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM.
A bit out of the scope of this PR but I think previously introducing a cache in the repo here is not worth the hassle. The queries are not that heavy and a simpler solution is just to cache responses within the context of a run like this:
@lru_cache()
def get_probe(manufacturer, probe_name):
# Download fresh each session, cache in memory
return _download_and_parse(manufacturer, probe_name)
And do the same for all the functions that fetch from the web. I think this one-line decorator would bring 95 % of the benefits of the cache and avoid known problems with caches such as: cache invalidation, partial download, cache cleaning, making the cache compliant with best practices (e.g. XDG_CACHE_HOME
), etc.
For example, this PR is breaking with the previous structure which I guess we are not really handling. I don't think is worth it either.
Ah, yes one, final comment, some functions are authenticated list_github_folders
but get_probe
is not. I don't know if that is intentional.
for more information, see https://pre-commit.ci
That's a good point, but I think that is not persistent to disk, right? The goal of the caching system is to have a local copy that could also work without internet access. Or am I interpreting the
This is intentional, since you might hit a "too many requests" issue without authentication (e.g., in CI). It will work also without, but not with many calls like we have in tests. |
… into update-get-probe
for more information, see https://pre-commit.ci
No it does not solve the problem of access without internet. Just 95 % of the performance use case.
Right, I am saying that some of the fetching functions are lacking the authentification ( |
The get probe doesn't need authentication though, since it fetches the JSON file directly using the raw url :) the authentication is needed by the list functions, since they use the GH API to retrieve info |
Ah, thanks for the explanation. That makes sense. |
This PR improves the interaction with the library by adding:
get_tags_in_library()
to get available probeinterface_library tagslist_manufacturers(tag=None)
to retrieve available manufacturerslist_probes_by_manufacturer(manufacturer, tag=None)
to get probes from a manufacturerlist_all_probes(tag=None)
to get a dict {manufacturer: [probes]}this should solve a couple of issues: #362 SpikeInterface/probeinterface_library#20
Note: there is no release yet in probeinterface_library, but one should be on the way: SpikeInterface/probeinterface_library#25